// pages/api/wiki.js
import axios from 'axios';




export default async (req, res) => {
    try {

        const { path } = req.query;
       
        const BLOG_BASE_URL = process.env.BLOG_BASE_URL;
        const hexoUrl = `${BLOG_BASE_URL}/${path || ''}/`;
        console.log(hexoUrl)
        const response = await axios.get(hexoUrl);
       
        for ([key,value] of Object.entries(response.headers)){
            res.setHeader(key,value)
        }
        res.status(200).json(response.data);
    } catch (error) {
        res.status(error.response?.status || 500).json({ error: error.message });
    }
  };